package com.problem.leetcode;

/**
 * @author didi
 * @DESCRIPTION
 * @create 2019-05-01 19:13
 **/

public class Problem263 {
    public boolean isUgly(int num) {

        if (num < 1) {
            return false;
        }

        int[] nums = new int[]{2, 3, 5};

        for (int index = 0; index < nums.length; index++) {
            while (num > 0) {
                if (num % nums[index] == 0) {
                    num /= nums[index];
                } else {
                    break;
                }
            }
        }
        return num == 1;
    }
}
